// point.h

// Copyright (C) 2010  traxex

// Author: 	traxex <traxex@yahoo.cn>
// Created: 	18 Aug 2010
// Version: 	1.0

#pragma once

namespace traxex{

template<typename T>struct __maxalign__ Point3D{
    T	x;
    T	y;
    T	z;
};

template<typename T>struct __maxalign__ Point2D{
    T	x;
    T	y;
};

template<typename T> pure T distance( const Point3D<T> &a, const Point3D<T> &b){
    return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) + (a.z-b.z)*(a.z-b.z));
}

template<typename T> pure T distance( const Point2D<T> &a, const Point2D<T> &b){
    return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}

template<typename T> pure T distance( const T &a, const T &b){
    return abs(a-b);
}

}
